﻿using UnityEngine;


namespace TimeCounterISM
{
    public class TimeCounter
    {
        public float TotalTime { private set; get; }
        public float RunningTime { private set; get; }
        public bool IsRunning { private set; get; }


        public virtual void Run()
        {
            IsRunning = RunningTime < TotalTime;
            if (IsRunning)
                RunningTime += 1f * Time.deltaTime;
        }

        public virtual float GetLerp()
        {
            return RunningTime / TotalTime;
        }


        private TimeCounter() { }
        public TimeCounter(float time)
        {
            TotalTime = time;
            IsRunning = false;
        }
    }
}
